<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>String</title>
</head>
<body>
    <script>
        let str = new String('Hello');
        console.log(str);
        console.log([...str]);

        str[Symbol.iterator] = function() {
            let cur = this;
            let index = -1;
            let len = cur.length;
            return {
                next: function() {
                    if( index++ < len-1) {
                        return {value: index+':'+cur[index]};
                    }
                    else {
                        return {done: true};
                    }
                }
            }            
        };
        console.log(str);
        console.log([...str]);
    </script>
</body>
</html>